<?php
/**
 *Login Controller
 *
 *
 *@author S.Feil, T.Ziegler, M.El-Hindi <goatymail@googlemail.com>
 *27 May 2012
 *@copyright Copyright (c) 2012, S.Feil, T.Ziegler, M.El-Hindi
 *@package cms
 *
 */
/**
 * Class Login_Controller
 * sets up login view
 *@package controller
 */
class Login_Controller extends Controller{

    /**
     * Holds the page handed over by the router
     * @var string
     */
    private $sPage = '';

    /**
     * Reference to view of content section
     * @var object
     */
    private $oContentView;

    /**
     * Reference to model that retrieves page data from db
     * @var object
     */
    private $oContentModel;

    /**
     * Reference to model that retrieves page navigation elements from db
     * @var object
     */
    private $oNavigationModel;

    /**
     * Reference to view of navigation section
     * @var object
     */
    private $oNavigationView;

    public function __construct(){
        //Get Viewmanger reference from parent constructor
        parent::__construct();
        //Load models and views
        $this->oContentView = $this->oViewmanager->getView('login');
    }

    /**
     * checks GET-Parameters forwarded from Router::route
     * @param Array $aArgs Arguments to check
     */
    public function checkArgs($aArgs){
        //Controller assumes that page name is the next GET element
        $this->sPage = array_shift($aArgs);
        //If there is no page name, then set the default page to index
        if ($this->sPage == ''){
            $this->sPage = 'index';
        }
    }

    /**
     * Handles request for cms login
     * Fetchs data and displays it
     * @param Array $aArgs GET-Parameters forwarded from Router:route
     */
    public function execute($aArgs){
        $this->checkArgs($aArgs);
        //Insert data in the correct section of the website layout
        $this->oViewmanager->setSection('Content', $this->oContentView->display());
    }
}
?>